#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

#define FAIL return puts("-1"),0

const int N = 2e5+10;

int b[N],c[N],n,cnt[66];
ll a[N],sum;

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in;
	for(int i = 1;i <= n;i++) b[i] = in;
	for(int i = 1;i <= n;i++) c[i] = in;
	for(int i = 1;i <= n;i++) sum += b[i] + c[i];
	if(sum % (n << 1)) FAIL; sum /= n<<1;
	for(int i = 1;i <= n;i++) {
		a[i] = (b[i] + c[i] - sum);
		if(a[i] % n) FAIL;
		a[i] /= n;
		for(int j = 0;j < 63;j++) if(a[i] >> j & 1) cnt[j]++;
	}
	for(int i = 1;i <= n;i++){
		ll t = 0;
		for(int j = 0;j < 63;j++) if(a[i] >> j & 1) t += cnt[j] * (1ll<<j);
		if(t != b[i]) FAIL;
		t = 0;
		for(int j = 0;j < 63;j++)
			if(a[i] >> j & 1) t += n * (1ll << j);
			else t += cnt[j] * (1ll<<j);
		if(t != c[i]) FAIL;
	}
	for(int i = 1;i <= n;i++) printf("%lld ",a[i]);
	return 0;
}

